﻿<div ng-controller="app.views.roleedit as vm">
    <!-- BEGIN PAGE BREADCRUMB -->
    <ul class="page-breadcrumb breadcrumb">
        <li>
            <a href="#/">主页</a><i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">系统设置</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#/RoleManage">角色管理</a>
            <i class="fa fa-circle"></i>
        </li>
        <li class="active">
            管理指定租户下的角色
        </li>
    </ul>
    <!-- END PAGE BREADCRUMB -->
    <!-- BEGIN PAGE CONTENT INNER -->
    <div class="portlet light">
        <div class="portlet-body">
            <div class="row">
                <div class="col-md-4">
                    <div class="portlet light bordered">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="icon-equalizer font-red-sunglo"></i>
                                <span class="caption-subject font-red-sunglo bold uppercase">角色编辑</span>
                                <span class="caption-helper">请编辑角色信息</span>
                            </div>
                        </div>
                        <div class="portlet-body form">
                            <!-- BEGIN FORM-->
                            <form action="javascript:;" class="form-horizontal" name="roleForm" ng-submit="submit()">
                                <div class="form-body">
                                    <div class="form-group">
                                        <label class="col-md-4 control-label">名称</label>
                                        <div class="col-md-8">
                                            <input type="text" name="name" ng-model="roleModel.name" required ng-minlength="2" ng-maxlength="50" class="form-control" placeholder="名称">
                                            <span class="has-error" ng-show="roleForm.name.$error">
                                                <span ng-show="roleForm.name.$error.minlength" class="help-block">该字段太短了.</span>
                                                <span ng-show="roleForm.name.$error.maxlength" class="help-block">该字段太长了.</span>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-4 control-label">角色名字</label>
                                        <div class="col-md-8">
                                            @*<div class="input-group">*@
                                            <input type="text" name="displayName" ng-model="roleModel.displayName" required ng-minlength="2" ng-maxlength=50 class="form-control" placeholder="角色名字">
                                            <span class="has-error" ng-show="roleForm.roleName.$error">
                                                <span ng-show="roleForm.roleName.$error.minlength" class="help-block">该字段太短了.</span>
                                                <span ng-show="roleForm.roleName.$error.maxlength" class="help-block">该字段太长了.</span>
                                            </span>
                                            @*</div>*@
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-4 control-label">是否默认</label>
                                        <div class="col-md-8">

                                            <select ng-model="roleModel.isDefault" name="isDefault" required ng-options="state.id as state.text for state in states" class="form-control"></select>

                                            <span class="has-error" ng-show="roleForm.isDefault.$error">
                                                <span ng-show="roleForm.isDefault.$error.required" class="help-block">该字段必选.</span>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-4 control-label">是否静态</label>
                                        <div class="col-md-8">

                                            <select ng-model="roleModel.isStatic" name="isStatic" required ng-options="state.id as state.text for state in states" class="form-control"></select>

                                            <span class="has-error" ng-show="roleForm.isStatic.$error">
                                                <span ng-show="roleForm.isStatic.$error.required" class="help-block">该字段必选.</span>
                                            </span>
                                        </div>
                                    </div>
                                    <div class="form-actions">
                                        <div class="row">
                                            <div class="col-md-offset-3 col-md-9">
                                                <div class="row">
                                                    <div class="col-md-8">
                                                        <button type="submit" class="btn green" ng-disabled="roleForm.$invalid">保存</button>
                                                        <button type="button" onclick="history.back()" class="btn default">取消</button>
                                                    </div>
                                                    <div class="col-md-1">
                                                        <button type="button" ng-show="roleModel.id" ng-click="delete()" class="btn red">删除</button>
                                                    </div>
                                                </div>


                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <!-- END FORM-->
                        </div>
                    </div>
                </div>
                <div class="col-md-8">
                    <div class="portlet light">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-cogs font-green-sharp"></i>
                                <span class="caption-subject font-green-sharp bold uppercase">权限列表</span>
                                <span class="caption-helper">选择角色权限并保存</span>
                            </div>
                            <div class="actions col-md-offset-3 col-md-3">
                                <a href="javascript:;" ng-click="saveRolePermissions()" class="btn btn-small green">保存权限</a>
                            </div>
                            <div class="tools">

                                @*<a href="javascript:;" class="collapse" data-original-title="" title="">
                                    </a>
                                    <a href="#portlet-config" data-toggle="modal" class="config" data-original-title="" title="">
                                    </a>
                                    <a href="javascript:;" class="reload" data-original-title="" title="">
                                    </a>
                                    <a href="javascript:;" class="remove" data-original-title="" title="">
                                    </a>*@
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div id="tree_permissions" >

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

